//
//  InvestmentCell.m
//  SP2P
//
//  Created by 吴建东 on 16/6/2.
//  Copyright © 2016年 EIMS. All rights reserved.
//

#import "InvestmentCell.h"

@implementation InvestmentCell

- (void)awakeFromNib {
    // Initialization code
     [super awakeFromNib];
    _backView.layer.shadowColor = KlayerBorder.CGColor;
    _backView.layer.shadowOpacity = 1.0f;
    _backView.layer.cornerRadius = 3.0f;
    
    _titleLabel.font = KFontSize(16);
    _rateLabel.font = KFontSize(30);
    _rateValue.font = KFontSize(13);
    _minTenderLabel.font = KFontSize(30);
    _minTenderValue.font = KFontSize(13);
    _tenderButton.titleLabel.font = KFontSize(14);
}

- (void)refreshCellWithModel:(InvestmentModel *)model {
    _titleLabel.text = model.investmentName;
    NSString *rateStr = [NSString stringWithFormat:@"%.1f%%",model.apr];
    NSString *minTendeStr = [NSString stringWithFormat:@"%ld个月起投",(long)model.period];
    _rateLabel.attributedText = [MyTools getNSMutableAttributedStringWithText:rateStr start:rateStr.length-1 end:rateStr.length textColor:RedwordColor textFont:KFontSize(13)];
    _minTenderLabel.attributedText = [MyTools getNSMutableAttributedStringWithText:minTendeStr start:minTendeStr.length-4 end:minTendeStr.length textColor:KGrayColor textFont:KFontSize(13)];
    if (model.period < 12) {
        _stausImageView.image = [UIImage imageNamed:@"invesment_staus_month"];
    }else {
        _stausImageView.image = [UIImage imageNamed:@"invesment_staus_year"];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
